<?php
include '../../init.php';

include DIR_CORE.'mysql.php';
$title = '沐水莲心-编辑单选题';

//接收要编辑题目信息
//var_dump($_POST);

$id = $_POST['id'];
$type_id = s($_POST['type']);
$question = s($_POST['question']);
$A = s($_POST['A']);
$B = s($_POST['B']);
$C = s($_POST['C']);
$D = s($_POST['D']);
$a = s($_POST['answer']);
$answer = strtoupper($a);
$time = time();

$sql = "update single set type_id = '$type_id',question = '$question',A='$A',B='$B',C='$C',D='$D',answer='$answer',create_time='$time' where id = '$id'";

$res = mysqli_query($link, $sql);
if ($res) {
    echo '<h2 style="color:green;font-weight:bold;">更新成功</h2>';
} else {
    echo '<h2 style="color:red;font-weight:red;">更新失败</h2>';
}
